home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #2 / Amiga Plus CD - 1995 - No. 2.iso / internet / faq / englisch / uucp-internals < prev    next >
Encoding:
Text File  |  1995-04-11  |  70.6 KB  |  1,588 lines

  1. Archive-name: uucp-internals
  2. Version: $Revision: 1.26 $
  3. Last-modified: $Date: 1994/10/26 02:39:07 $
  4.  
  5.  This article was written by Ian Lance Taylor <ian@airs.com> and I may
  6.  even update it periodically.  Please send me mail about suggestions
  7.  or inaccuracies.
  8.  
  9.  This article describes how the various UUCP protocols work, and
  10.  discusses some other internal UUCP issues.  It does not describe how
  11.  to configure UUCP, nor how to solve UUCP connection problems, nor how
  12.  to deal with UUCP mail.  I do not know of any FAQ postings on these
  13.  topics.  There are some documents on the net describing UUCP
  14.  configuration, but I can not keep an up to date list here; try using
  15.  archie.
  16.  
  17.  If you haven't read the news.announce.newusers articles, read them.
  18.  
  19.  This article is in digest format.  Some newsreaders will be able to
  20.  break it apart into separate articles.  Please don't ask me how to do
  21.  this, though.
  22.  
  23.  This article answers the following questions.  If one of these
  24.  questions is posted to comp.mail.uucp, please send mail to the poster
  25.  referring her or him to this FAQ.  There is no reason to post a
  26.  followup, as most of us know the answer already.
  27.  
  28. Sources
  29. What does "alarm" mean in debugging output?
  30. What are UUCP grades?
  31. What is the format of a UUCP lock file?
  32. What is the format of a UUCP X.* file?
  33. What is the UUCP protocol?
  34. What is the 'g' protocol?
  35. What is the 'f' protocol?
  36. What is the 't' protocol?
  37. What is the 'e' protocol?
  38. What is the 'G' protocol?
  39. What is the 'i' protocol?
  40. What is the 'j' protocol?
  41. What is the 'x' protocol?
  42. What is the 'y' protocol?
  43. What is the 'd' protocol?
  44. What is the 'h' protocol?
  45. What is the 'v' protocol?
  46. Thanks
  47.  
  48. ----------------------------------------------------------------------
  49.  
  50. From: Sources
  51. Subject: Sources
  52.  
  53. "Unix-to-Unix Copy Program," said PDP-1.  "You will never find a more
  54. wretched hive of bugs and flamers.  We must be cautious."
  55.                                                 --DECWars
  56.  
  57. I took a lot of the information from Jamie E. Hanrahan's paper in the
  58. Fall 1990 DECUS Symposium, and from Managing UUCP and Usenet by Tim
  59. O'Reilly and Grace Todino (with contributions by several other
  60. people).  The latter includes most of the former, and is published by
  61.         O'Reilly & Associates, Inc.
  62.         103 Morris Street, Suite A
  63.         Sebastopol, CA 95472
  64. It is currently in its tenth edition.  The ISBN number is
  65. 0-937175-93-5.
  66.  
  67. Some information is originally due to a Usenet article by Chuck
  68. Wegrzyn.  The information on execution files comes partially from
  69. Peter Honeyman.  The information on the 'g' protocol comes partially
  70. from a paper by G.L. Chesson of Bell Laboratories, partially from
  71. Jamie E. Hanrahan's paper, and partially from source code by John
  72. Gilmore.  The information on the 'f' protocol comes from the source
  73. code by Piet Berteema.  The information on the 't' protocol comes from
  74. the source code by Rick Adams.  The information on the 'e' protocol
  75. comes from a Usenet article by Matthias Urlichs.  The information on
  76. the 'd' protocol comes from Jonathan Clark, who also supplied
  77. information about QFT.  The FSUUCP information comes straight from
  78. Christopher J. Ambler; it applies to version 1.4 and up.
  79.  
  80. Although there are few books about UUCP, there are many about networks
  81. and protocols in general.  I recommend two non-technical books which
  82. describe the sorts of things that are available on the network: ``The
  83. Whole Internet,'' by Ed Krol, and ``Zen and the Art of the Internet,''
  84. by Brendan P. Kehoe.  Good technical discussions of networking issues
  85. can be found in ``Internetworking with TCP/IP,'' by Douglas E. Comer
  86. and David L. Stevens and in ``Design and Validation of Computer
  87. Protocols'' by Gerard J. Holzmann.
  88.  
  89. ------------------------------
  90.  
  91. From: alarm
  92. Subject: What does "alarm" mean in debugging output?
  93.  
  94. The debugging output of many versions of UUCP (but not Taylor UUCP)
  95. will include messages like
  96.     alarm 1
  97. or
  98.     pkcget: alarm 1
  99.  
  100. This message means that the UUCP package has timed out while waiting
  101. for some sort of response from the remote system.  This normally
  102. indicates some sort of connection problem.  For example, the modems
  103. might have lost their connection, or perhaps one of the modems will
  104. not transmit the XON and XOFF characters, or perhaps one side or the
  105. other is dropping characters.  It can also mean that the packages
  106. disagree about some aspect of the UUCP protocol, although this is less
  107. common.
  108.  
  109. Using the information in the rest of this posting, you should be able
  110. to figure out what type of data your UUCP was expecting to receive.
  111. This may give some indication as to exactly what the problem is.  It
  112. is difficult to be more specific, since there are many possiblities.
  113.  
  114. ------------------------------
  115.  
  116. From: UUCP-grades
  117. Subject: What are UUCP grades?
  118.  
  119. Modern UUCP packages support grades for each command.  The grades
  120. generally range from 'A' (the highest) to 'Z' followed by 'a' to 'z'.
  121. Some UUCP packages also support '0' to '9' before 'A'.  Some UUCP
  122. packages may permit any ASCII character as a grade.
  123.  
  124. On Unix, these grades are encoded in the name of the command file.  A
  125. command file name generally has the form
  126.     C.nnnngssss
  127. where nnnn is the remote system name for which the command is queued,
  128. g is a single character grade, and ssss is a four character sequence
  129. number.  For example, a command file created for the system ``airs''
  130. at grade 'Z' might be named
  131.     C.airsZ2551
  132.  
  133. The remote system name will be truncated to seven characters, to
  134. ensure that the command file name will fit in the 14 character file
  135. name limit of the traditional Unix file system.  UUCP packages which
  136. have no other means of distinguishing which command files are intended
  137. for which systems thus require all systems they connect to to have
  138. names that are unique in the first seven characters.  Some UUCP
  139. packages use a variant of this format which truncates the system name
  140. to six characters.  HDB and Taylor UUCP use a different spool
  141. directory format, which allows up to fourteen characters to be used
  142. for each system name.
  143.  
  144. The sequence number in the command file name may be a decimal integer,
  145. or it may be a hexadecimal integer, or it may contain any alphanumeric
  146. character.  Different UUCP packages are different.
  147.  
  148. FSUUCP (a DOS based UUCP and news package) uses up to 8 characters for
  149. file names in the spool (this is a DOS file name limitation; actually,
  150. with the extension, 11 characters are available, but FSUUCP reserves
  151. that for future use).  FSUUCP defaults mail to grade D, and news to
  152. grade N, except that when the grade of incoming mail can be
  153. determined, that grade is preserved if the mail is forwarded to
  154. another system.  Mail and news are currently the only 2 types of
  155. transfers supported.  The default grades may be changed by editing
  156. the MAIL.RC file for mail, or the FSUUCP.CFG file for news.
  157.  
  158. UUPC/extended for DOS, OS/2 and Windows NT handles mail at grade 'C',
  159. news at grade 'd', and file transfers at grade 'n'.  The UUPC/extended
  160. UUCP and RMAIL commands accept grades to override the default, the
  161. others do not.
  162.  
  163. I do not know how command grades are handled in other non-Unix UUCP
  164. packages.
  165.  
  166. Modern UUCP packages allow you to restrict file transfer by grade
  167. depending on the time of day.  Typically this is done with a line in
  168. the Systems (or L.sys) file like this:
  169.     airs Any/Z,Any2305-0855 ...
  170. This allows grades 'Z' and above to be transferred at any time.  Lower
  171. grades may only be transferred at night.  I believe that this grade
  172. restriction applies to local commands as well as to remote commands,
  173. but I am not sure.  It may only apply if the UUCP package places the
  174. call, not if it is called by the remote system.
  175.  
  176. Taylor UUCP can use the ``timegrade'' and ``call-timegrade'' commands
  177. to achieve the same effect (and supports the above format when reading
  178. Systems or L.sys).
  179.  
  180. UUPC/extended provides the symmetricgrades option to announce the
  181. current grade in effect when calling the remote system.
  182.  
  183. This sort of grade restriction is most useful if you know what grades
  184. are being used at the remote site.  The default grades used depend on
  185. the UUCP package.  Generally uucp and uux have different defaults.  A
  186. particular grade can be specified with the -g option to uucp or uux.
  187. For example, to request execution of rnews on airs with grade 'd', you
  188. might use something like
  189.     uux -gd - airs!rnews <article
  190.  
  191. Uunet queues up mail at grade 'C', but increases the grade based on
  192. the size.  News is queued at grade 'd', and file transfers at grade
  193. 'n'.  The example above would allow mail (below some large size) to be
  194. received at any time, but would only permit news to be transferred at
  195. night.
  196.  
  197. ------------------------------
  198.  
  199. From: UUCP-lock-file
  200. Subject: What is the format of a UUCP lock file?
  201.  
  202. This discussion applies only to Unix.  I have no idea how UUCP locks
  203. ports on other systems.
  204.  
  205. UUCP creates files to lock serial ports and systems.  On most if not
  206. all systems these same lock files are also used by cu to coordinate
  207. access to serial ports.  On some systems getty also uses these lock
  208. files, often under the name uugetty.
  209.  
  210. The lock file normally contains the process ID of the locking process.
  211. This makes it easy to determine whether a lock is still valid.  The
  212. algorithm is to create a temporary file and then link it to the name
  213. that must be locked.  If the link fails because a file with that name
  214. already exists, the existing file is read to get the process ID.  If
  215. the process still exists, the lock attempt fails.  Otherwise the lock
  216. file is deleted and the locking algorithm is retried.
  217.  
  218. Older UUCP packages put the lock files in the main UUCP spool
  219. directory, /usr/spool/uucp.  HDB UUCP generally puts the lock files in
  220. a directory of their own, usually /usr/spool/locks or /etc/locks.
  221.  
  222. The original UUCP lock file format encodes the process ID as a four
  223. byte binary number.  The order of the bytes is host-dependent.  HDB
  224. UUCP stores the process ID as a ten byte ASCII decimal number, with a
  225. trailing newline.  For example, if process 1570 holds a lock file, it
  226. would contain the eleven characters space, space, space, space, space,
  227. space, one, five, seven, zero, newline.  Some versions of UUCP add a
  228. second line indicating which program created the lock (uucp, cu, or
  229. getty/uugetty).  I have also seen a third type of UUCP lock file which
  230. does not contain the process ID at all.
  231.  
  232. The name of the lock file is traditionally "LCK.." followed by the
  233. base name of the device.  For example, to lock /dev/ttyd0 the file
  234. LCK..ttyd0 would be created.  On SCO Unix, the lock file name is
  235. always forced to lower case even if the device name has upper case
  236. letters.
  237.  
  238. System V Release 4 UUCP names the lock file using the major and minor
  239. device numbers rather than the device name.  The file is named
  240. LK.XXX.YYY.ZZZ, where XXX, YYY and ZZZ are all three digit decimal
  241. numbers.  XXX is the major device number of the device holding the
  242. directory holding the device file (e.g., /dev).  YYY is the major
  243. device number of the device file itself.  ZZZ is the minor device
  244. number of the device file itself.  If s holds the result of passing
  245. the device to the stat system call (e.g., stat ("/dev/ttyd0", &s)),
  246. the following line of C code will print out the corresponding lock
  247. file name:
  248.     printf ("LK.%03d.%03d.%03d", major (s.st_dev),
  249.             major (s.st_rdev), minor (s.st_rdev));
  250. The advantage of this system is that even if there are several links
  251. to the same device, they will all use the same lock file name.
  252.  
  253. ------------------------------
  254.  
  255. From: X-file
  256. Subject: What is the format of a UUCP X.* file?
  257.  
  258. UUCP X.* files control program execution.  They are created by uux.
  259. They are transferred between computers just like any other file.  The
  260. uuxqt daemon reads them to figure out how to execute the job requested
  261. by uux.
  262.  
  263. An X.* file is simply a text file.  The first character of each line
  264. is a command, and the remainder of the line supplies arguments.  The
  265. following commands are defined:
  266.     C command
  267.         This gives the command to execute, including the program and
  268.         all arguments.  For example,
  269.             C rmail ian@airs.com
  270.     U user system
  271.         This names the user who requested the command, and the system
  272.         from which the request came.
  273.     I standard-input
  274.         This names the file from which standard input is taken.  If no
  275.         standard input file is given, the standard input will probably
  276.         be attached to /dev/null.  If the standard input file is not
  277.         from the system on which the execution is to occur, it will
  278.         also appear in an F command.
  279.     O standard-output [ system ]
  280.         This names the standard output file.  The optional second
  281.         argument names the system to which the file should be sent.
  282.         If there is no second argument, the file should be created on
  283.         the executing system.
  284.     F required-file [ filename-to-use ]
  285.         The F command can appear multiple times.  Each F command names
  286.         a file which must exist before the execution can proceed.
  287.         This will usually be a file which is transferred from the
  288.         system on which uux was executed, but it can also be a file
  289.         from the local system or some other system.  If the file is
  290.         not from the local system, then the command will usually name
  291.         a file in the spool directory.  If the optional second
  292.         argument appears, then the file should be copied to the
  293.         execution directory under that name.  This is necessary for
  294.         any file other than the standard input file.  If the standard
  295.         input file is not from the local system, it will appear in
  296.         both an F command and an I command.
  297.     R requestor-address
  298.         This is the address to which mail about the job should be
  299.         sent.  It is relative to the system named in the U command.
  300.         If the R command does not appear, then mail is sent to the
  301.         user named in the U command.
  302.     Z
  303.         This command takes no arguments.  It means that a mail message
  304.         should be sent if the command failed.  This is the default
  305.         behaviour for most modern UUCP packages, and for them the Z
  306.         command does not actually do anything.
  307.     N
  308.         This command takes no arguments.  It means that no mail
  309.         message should be sent, even if the command failed.
  310.     n
  311.         This command takes no arguments.  It means that a mail message
  312.         should be sent if the command succeeded.  Normally a message
  313.         is sent only if the command failed.
  314.     B
  315.         This command takes no arguments.  It means that the standard
  316.         input should be returned with any error message.  This can be
  317.         useful in cases where the input would otherwise be lost.
  318.     e
  319.         This command takes no arguments.  It means that the command
  320.         should be processed with /bin/sh.  For some packages this is
  321.         the default anyhow.  Most packages will refuse to execute
  322.         complex commands or commands containing wildcards, because of
  323.         the security holes this opens.
  324.     E
  325.         This command takes no arguments.  It means that the command
  326.         should be processed with the execve system call.  For some
  327.         packages this is the default anyhow.
  328.     M status-file
  329.         This command means that instead of mailing a message, the
  330.         message should be copied to the named file on the system named
  331.         by the U command.
  332.     # comment
  333.         This command is ignored, as is any other unrecognized command.  
  334.  
  335. Here is an example.  Given the following command executed on system
  336. test1
  337.     uux - test2!cat - test2!~ian/bar !qux '>~/gorp'
  338. (this is only an example, as most UUCP systems will not permit the cat
  339. command to be executed) Taylor UUCP will produce the following X.
  340. file:
  341.     U ian test1
  342.     F D.test1N003r qux
  343.     O /usr/spool/uucppublic test1
  344.     F D.test1N003s
  345.     I D.test1N003s
  346.     C cat - ~ian/bar qux
  347. The standard input will be read into a file and then transferred to
  348. the file D.test1N003s on system test2, and the file qux will be
  349. transferred to D.test1N003r on system test2.  When the command is
  350. executed, the latter file will be copied to the execution directory
  351. under the name qux.  Note that since the file ~ian/bar is already on
  352. the execution system, no action need be taken for it.  The standard
  353. output will be collected in a file, then copied to the directory
  354. /usr/spool/uucppublic on the system test1.
  355.  
  356. ------------------------------
  357.  
  358. From: UUCP-protocol
  359. Subject: What is the UUCP protocol?
  360.  
  361. The UUCP protocol is a conversation between two UUCP packages.  A UUCP
  362. conversation consists of three parts: an initial handshake, a series
  363. of file transfer requests, and a final handshake.
  364.  
  365. Before the initial handshake, the caller will usually have logged in
  366. the called machine and somehow started the UUCP package there.  On
  367. Unix this is normally done by setting the shell of the login name used
  368. to /usr/lib/uucp/uucico.
  369.  
  370. All messages in the initial handshake begin with a ^P (a byte with the
  371. octal value \020) and end with a null byte (\000).  A few systems end
  372. these messages with a line feed character (\012) instead of a null
  373. byte; the examples below assume a null byte is being used.
  374.  
  375. Some options below are supported by QFT, which stands for Queued File
  376. Transfer, and is (or was) an internal Bell Labs version of UUCP.  
  377.  
  378. Taylor UUCP size negotiation was introduced by Taylor UUCP, and is
  379. also supported by DOS based FSUUCP and Amiga based wUUCP and
  380. UUCP-1.17.
  381.  
  382. The initial handshake goes as follows.  It is begun by the called
  383. machine.
  384.  
  385. called: \020Shere=hostname\000
  386.     The hostname is the UUCP name of the called machine.  Older UUCP
  387.     packages do not output it, and simply send \020Shere\000.
  388.  
  389. caller: \020Shostname options\000
  390.     The hostname is the UUCP name of the calling machine.  The
  391.     following options may appear (or there may be none):
  392.         -QSEQ
  393.             Report sequence number for this conversation.  The
  394.             sequence number is stored at both sites, and incremented
  395.             after each call.  If there is a sequence number mismatch,
  396.             something has gone wrong (somebody may have broken
  397.             security by pretending to be one of the machines) and the
  398.             call is denied.  If the sequence number changes on one of
  399.             the machines, perhaps because of an attempted breakin or
  400.             because a disk backup was restored, the sequence numbers
  401.             on the two machines must be reconciled manually.  This is
  402.             not supported by FSUUCP.
  403.         -xLEVEL
  404.             Requests the called system to set its debugging level to
  405.             the specified value.  This is not supported by all
  406.             systems.
  407.         -pGRADE
  408.         -vgrade=GRADE
  409.             Requests the called system to only transfer files of the
  410.             specified grade or higher.  This is not supported by all
  411.             systems.  Some systems support -p, some support -vgrade=.
  412.         -R
  413.             Indicates that the calling UUCP understands how to restart
  414.             failed file transmissions.  Supported only by System V
  415.             Release 4 UUCP and QFT.
  416.         -ULIMIT
  417.             Reports the ulimit value of the calling UUCP.  The limit
  418.             is specified as a base 16 number in C notation (e.g.,
  419.             -U0x1000000).  This number is the number of 512 byte
  420.             blocks in the largest file which the calling UUCP can
  421.             create.  The called UUCP may not transfer a file larger
  422.             than this.  Supported only by System V Release 4 UUCP, QFT
  423.             and FSUUCP.  FSUUCP reports the lesser of the
  424.             available disk space on the spool directory drive and the
  425.             ulimit variable in FSUUCP.CFG.
  426.         -N
  427.             Indicates that the calling UUCP understands the Taylor
  428.             UUCP size negotiation extension.  Not supported by
  429.         traditional UUCP packages.
  430.  
  431. called: \020ROK\000
  432.     There are actually several possible responses.
  433.         ROK
  434.             The calling UUCP is acceptable, and the handshake proceeds
  435.             to the protocol negotiation.  Some options may also
  436.             appear; see below.
  437.         ROKN
  438.             The calling UUCP is acceptable, it specified -N, and the
  439.             called UUCP also understands the Taylor UUCP size limiting
  440.             extensions.
  441.         RLCK
  442.             The called UUCP already has a lock for the calling UUCP,
  443.             which normally indicates the two machines are already
  444.             communicating.
  445.         RCB
  446.             The called UUCP will call back.  This may be used to avoid
  447.             impostors (but only one machine out of each pair should
  448.             call back, or no conversation will ever begin).
  449.         RBADSEQ
  450.             The call sequence number is wrong (see the -Q discussion
  451.             above). 
  452.         RLOGIN
  453.             The calling UUCP is using the wrong login name.
  454.         RYou are unknown to me
  455.             The calling UUCP is not known to the called UUCP, and the
  456.             called UUCP does not permit connections from unknown
  457.             systems.  Some versions of UUCP just drop the line rather
  458.             than sending this message.
  459.  
  460.     If the response is ROK, the following options are supported by
  461.     System V Release 4 UUCP and QFT.
  462.         -R
  463.             The called UUCP knows how to restart failed file
  464.             transmissions.
  465.         -ULIMIT
  466.             Reports the ulimit value of the called UUCP.  The limit is
  467.             specified as a base 16 number in C notation.  This number
  468.             is the number of 512 byte blocks in the largest file which
  469.             the called UUCP can create.  The calling UUCP may not send
  470.             a file larger than this.  Also supported by FSUUCP.
  471.         -xLEVEL
  472.             I'm not sure just what this means.  It may request the
  473.             calling UUCP to set its debugging level to the specified
  474.             value.
  475.     If the response is not ROK (or ROKN) both sides hang up the phone,
  476.     abandoning the call.
  477.  
  478. called: \020Pprotocols\000
  479.     Note that the called UUCP outputs two strings in a row.  The
  480.     protocols string is a list of UUCP protocols supported by the
  481.     caller.  Each UUCP protocol has a single character name.  These
  482.     protocols are discussed in more detail later in this document.
  483.     For example, the called UUCP might send \020Pgf\000.
  484.  
  485. caller: \020Uprotocol\000
  486.     The calling UUCP selects which protocol to use out of the
  487.     protocols offered by the called UUCP.  If there are no mutually
  488.     supported protocols, the calling UUCP sends \020UN\000 and both
  489.     sides hang up the phone.  Otherwise the calling UUCP sends
  490.     something like \020Ug\000.
  491.  
  492. Most UUCP packages will consider each locally supported protocol in
  493. turn and select the first one supported by the called UUCP.  With some
  494. versions of HDB UUCP, this can be modified by giving a list of
  495. protocols after the device name in the Devices file or the Systems
  496. file.  For example, to select the 'e' protocol in Systems,
  497.     airs Any ACU,e ...
  498. or in Devices,
  499.     ACU,e ttyXX ...
  500. Taylor UUCP provides the ``protocol'' command which may be used either
  501. for a system or a port.
  502.  
  503. After the protocol has been selected and the initial handshake has been
  504. completed, both sides turn on the selected protocol.  For some
  505. protocols (notably 'g') a further handshake is done at this point.
  506.  
  507. Each protocol supports a method for sending a command to the remote
  508. system.  This method is used to transmit a series of commands between
  509. the two UUCP packages.  At all times, one package is the master and
  510. the other is the slave.  Initially, the calling UUCP is the master.
  511.  
  512. If a protocol error occurs during the exchange of commands, both sides
  513. move immediately to the final handshake.
  514.  
  515. The master will send one of four commands: S, R, X or H.
  516.  
  517. Any file name referred to below is either an absolute pathname
  518. beginning with "/", a public directory pathname beginning with "~/", a
  519. pathname relative to a user's home directory beginning with "~USER/",
  520. or a spool directory file name.  File names in the spool directory are
  521. not pathnames, but instead are converted to pathnames within the spool
  522. directory by UUCP.  They always begin with "C." (for a command file
  523. created by uucp or uux), "D." (for a data file created by uucp, uux or
  524. by an execution, or received from another system for an execution), or
  525. "X." (for an execution file created by uux or received from another
  526. system).
  527.  
  528. master: S FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE
  529.     The S and the - are literal characters.  This is a request by the
  530.     master to send a file to the slave.
  531.         FROM
  532.             The name of the file to send.  If the C option does not
  533.             appear in OPTIONS, the master will actually open and send
  534.             this file.  Otherwise the file has been copied to the
  535.             spool directory, where it is named TEMP.  The slave
  536.             ignores this field unless TO is a directory, in which case
  537.             the basename of FROM will be used as the file name.  If
  538.             FROM is a spool directory filename, it must be a data file
  539.             created for or by an execution, and must begin with "D.".
  540.         TO
  541.             The name to give the file on the slave.  If this field
  542.             names a directory the file is placed within that directory
  543.             with the basename of FROM.  A name ending in `/' is taken
  544.             to be a directory even if one does not already exist with
  545.             that name.  If TO begins with `X.', an execution file will
  546.             be created on the slave.  Otherwise, if TO begins with
  547.             `D.' it names a data file to be used by some execution
  548.             file.  Otherwise, TO should not be in the spool directory.
  549.         USER
  550.             The name of the user who requested the transfer.
  551.         OPTIONS
  552.             A list of options to control the transfer.  The following
  553.             options are defined (all options are single characters):
  554.                 C
  555.                     The file has been copied to the spool directory
  556.                     (the master should use TEMP rather than FROM).
  557.                 c
  558.                     The file has not been copied to the spool
  559.                     directory (this is the default).
  560.                 d
  561.                     The slave should create directories as necessary
  562.                     (this is the default).
  563.                 f
  564.                     The slave should not create directories if
  565.                     necessary, but should fail the transfer instead.
  566.                 m
  567.                     The master should send mail to USER when the
  568.                     transfer is complete (not supported by FSUUCP).
  569.                 n
  570.                     The slave should send mail to NOTIFY when the
  571.                     transfer is complete (not supported by FSUUCP).
  572.         TEMP
  573.             If the C option appears in OPTIONS, this names the file to
  574.             be sent.  Otherwise if FROM is in the spool directory,
  575.             TEMP is the same as FROM.  Otherwise TEMP may be a dummy
  576.             string, such as "D.0".  After the transfer has been
  577.             succesfully completed, the master will delete the file
  578.             TEMP.
  579.         MODE
  580.             This is an octal number giving the mode of the file on
  581.             MASTER.  If the file is not in the spool directory, the
  582.             slave will always create it with mode 0666, except that if
  583.             (MODE & 0111) is not zero (the file is executable), the
  584.             slave will create the file with mode 0777.  If the file is
  585.             in the spool directory, some UUCP packages will use the
  586.             algorithm above and some will always create the file with
  587.             mode 0600.  This field is not used by FSUUCP, since it is
  588.             meaningless on DOS.
  589.         NOTIFY
  590.             This field may not be present, and in any case is only
  591.             meaningful if the n option appears in OPTIONS.  If the n
  592.             option appears, then when the transfer is successfully
  593.             completed, the slave will send mail to NOTIFY, which must
  594.             be a legal mailing address on the slave.  If a SIZE field
  595.             will appear but the n option does not appear, NOTIFY will
  596.             always be present, typically as the string "dummy" or
  597.             simply a pair of double quotes.
  598.         SIZE
  599.             This field is only present when doing Taylor UUCP or SVR4
  600.             UUCP size negotiation, It is the size of the file in
  601.             bytes.  Taylor UUCP version 1.03 sends the size as a
  602.             decimal integer, while versions 1.04 and up, and all other
  603.             UUCP packages that support size negotiation, send the size
  604.             in base 16 with a leading 0x.
  605.  
  606.     The slave then responds with an S command response.
  607.         SY START
  608.             The slave is willing to accept the file, and file transfer
  609.             begins.  The START field will only be present when using
  610.             file restart.  It specifies the byte offset into the file
  611.             at which to start sending.  If this is a new file, START
  612.             will be 0x0.
  613.         SN2
  614.             The slave denies permission to transfer the file.  This
  615.             can mean that the destination directory may not be
  616.             accessed, or that no requests are permitted.  It implies
  617.             that the file transfer will never succeed.
  618.         SN4
  619.             The slave is unable to create the necessary temporary
  620.             file.  This implies that the file transfer might succeed
  621.             later.
  622.         SN6
  623.             This is only used by Taylor UUCP size negotiation.  It
  624.             means that the slave considers the file too large to
  625.             transfer at the moment, but it may be possible to transfer
  626.             it at some other time.
  627.         SN7
  628.             This is only used by Taylor UUCP size negotiation.  It
  629.             means that the slave considers the file too large to ever
  630.             transfer.
  631.         SN8
  632.             This is only used by Taylor UUCP.  It means that the file
  633.             was already received in a previous conversation.  This can
  634.             happen if the receive acknowledgement was lost after it
  635.             was sent by the receiver but before it was received by the
  636.             sender.
  637.     SN9
  638.         This is only used by Taylor UUCP (versions 1.05 and up)
  639.         and FSUUCP (versions 1.5 and up).  It means that the
  640.         remote system was unable to open another channel (see the
  641.         discussion of the 'i' protocol for more information about
  642.         channels).  This implies that the file transfer might
  643.         succeed later.
  644.         SN10
  645.             This is reportedly used by SVR4 UUCP to mean that the file
  646.             size is too large.
  647.  
  648.     If the slave responds with SY, a file transfer begins.  When the
  649.     file transfer is complete, the slave sends a C command response.
  650.         CY
  651.             The file transfer was successful.
  652.         CYM
  653.             The file transfer was successful, and the slave wishes to
  654.             become the master; the master should send an H command,
  655.             described below.
  656.         CN5
  657.             The temporary file could not be moved into the final
  658.             location.  This implies that the file transfer will never
  659.             succeed.
  660.  
  661.     After the C command response has been received (in the SY case) or
  662.     immediately (in an SN case) the master will send another command.
  663.  
  664. master: R FROM TO USER -OPTIONS SIZE
  665.     The R and the - are literal characters.  This is a request by the
  666.     master to receive a file from the slave.  I do not know how SVR4
  667.     UUCP or QFT implement file transfer restart in this case.
  668.         FROM
  669.             This is the name of the file on the slave which the master
  670.             wishes to receive.  It must not be in the spool directory,
  671.             and it may not contain any wildcards.
  672.         TO
  673.             This is the name of the file to create on the master.  I
  674.             do not believe that it can be a directory.  It may only be
  675.             in the spool directory if this file is being requested to
  676.             support an execution either on the master or on some
  677.             system other than the slave.
  678.         USER
  679.             The name of the user who requested the transfer.
  680.         OPTIONS
  681.             A list of options to control the transfer.  The following
  682.             options are defined (all options are single characters):
  683.                 d
  684.                     The master should create directories as necessary
  685.                     (this is the default).
  686.                 f
  687.                     The master should not create directories if
  688.                     necessary, but should fail the transfer instead.
  689.                 m
  690.                     The master should send mail to USER when the
  691.                     transfer is complete.
  692.         SIZE
  693.             This only appears if Taylor UUCP size negotiation is being
  694.             used.  It specifies the largest file which the master is
  695.             prepared to accept (when using SVR4 UUCP or QFT, this was
  696.             specified in the -U option during the initial handshake).
  697.  
  698.     The slave then responds with an R command response.  FSUUCP does
  699.     not support R requests, and always responds with RN2.
  700.         RY MODE [ SIZE ]
  701.             The slave is willing to send the file, and file transfer
  702.             begins.  MODE is the octal mode of the file on the slave.
  703.             The master treats this just as the slave does the MODE
  704.             argument in the send command, q.v.  I am told that SVR4
  705.             UUCP sends a trailing SIZE argument.  For some versions of
  706.             BSD UUCP, the MODE argument may have a trailing M
  707.             character (e.g., RY 0666M).  This means that the slave
  708.             wishes to become the master.
  709.         RN2
  710.             The slave is not willing to send the file, either because
  711.             it is not permitted or because the file does not exist.
  712.             This implies that the file request will never succeed.
  713.         RN6
  714.             This is only used by Taylor UUCP size negotiation.  It
  715.             means that the file is too large to send, either because
  716.             of the size limit specifies by the master or because the
  717.             slave considers it too large.  The file transfer might
  718.             succeed later, or it might not (this will be cleared up in
  719.             a later release of Taylor UUCP).
  720.     RN9
  721.         This is only used by Taylor UUCP (versions 1.05 and up)
  722.         and FSUUCP (versions 1.5 and up).  It means that the
  723.         remote system was unable to open another channel (see the
  724.         discussion of the 'i' protocol for more information about
  725.         channels).  This implies that the file transfer might
  726.         succeed later.
  727.  
  728.     If the slave responds with RY, a file transfer begins.  When the
  729.     file transfer is complete, the master sends a C command.  The
  730.     slave pretty much ignores this, although it may log it.
  731.         CY
  732.             The file transfer was successful.
  733.         CN5
  734.             The temporary file could not be moved into the final
  735.             location.
  736.  
  737.     After the C command response has been sent (in the RY case) or
  738.     immediately (in an RN case) the master will send another command.
  739.  
  740. master: X FROM TO USER -OPTIONS
  741.     The X and the - are literal characters.  This is a request by the
  742.     master to, in essence, execute uucp on the slave.  The slave
  743.     should execute "uucp FROM TO".
  744.         FROM
  745.             This is the name of the file or files on the slave which
  746.             the master wishes to transfer.  Any wildcards are expanded
  747.             on the slave.  If the master is requesting that the files
  748.             be transferred to itself, the request would normally
  749.             contain wildcard characters, since otherwise an `R'
  750.             command would suffice.  The master can also use this
  751.             command to request that the slave transfer files to a
  752.             third system.
  753.         TO
  754.             This is the name of the file or directory to which the
  755.             files should be transferred.  This will normally use a
  756.             UUCP name.  For example, if the master wishes to receive
  757.             the files itself, it would use "master!path".
  758.         USER
  759.             The name of the user who requested the transfer.
  760.         OPTIONS
  761.             A list of options to control the transfer.  It is not
  762.             clear which, if any, options are supported by most UUCP
  763.             packages.
  764.  
  765.     The slave then responds with an X command response.  FSUUCP does
  766.     not support X requests, and always responds with XN.
  767.         XY
  768.             The request was accepted, and the appropriate file
  769.             transfer commands have been queued up for later
  770.             processing.
  771.         XN
  772.             The request was denied.  No particular reason is given.
  773.  
  774.     In either case, the master will then send another command.
  775.  
  776. master: H
  777.     This is used by the master to hang up the connection.  The slave
  778.     will respond with an H command response.
  779.         HY
  780.             The slave agrees to hang up the connection.  In this case
  781.             the master sends another HY command.  In some UUCP
  782.             packages the slave will then send a third HY command.  At
  783.             this point the protocol is shut down, and the final
  784.             handshake is begun.
  785.         HN
  786.             The slave does not agree to hang up.  In this case the
  787.             master and the slave exchange roles.  The next command
  788.             will be sent by the former slave, which is the new master.
  789.             The roles may be reversed several times during a single
  790.             connection.
  791.  
  792. After the protocol has been shut down, the final handshake is
  793. performed.  This handshake has no real purpose, and some UUCP packages
  794. simply drop the connection rather than do it (in fact, some will drop
  795. the connection immediately after both sides agree to hangup, without
  796. even closing down the protocol).
  797.  
  798. caller: \020OOOOOO\000
  799. called: \020OOOOOOO\000
  800.  
  801. That is, the calling UUCP sends six O's and the called UUCP replies
  802. with seven O's.  Some UUCP packages always send six O's.
  803.  
  804. ------------------------------
  805.  
  806. From: UUCP-g
  807. Subject: What is the 'g' protocol?
  808.  
  809. The 'g' protocol is a packet based flow controlled error correcting
  810. protocol that requires an eight bit clear connection.  It is the
  811. original UUCP protocol, and is supported by all UUCP implementations.
  812. Many implementations of it are only able to support small window and
  813. packet sizes, specifically a window size of 3 and a packet size of 64
  814. bytes, but the protocol itself can support up to a window size of 7
  815. and a packet size of 4096 bytes.  Complaints about the inefficiency of
  816. the 'g' protocol generally refer to specific implementations, rather
  817. than to the correctly implemented protocol.
  818.  
  819. The 'g' protocol was originally designed for general packet drivers,
  820. and thus contains some features that are not used by UUCP, including
  821. an alternate data channel and the ability to renegotiate packet and
  822. window sizes during the communication session.
  823.  
  824. The 'g' protocol is spoofed by many Telebit modems.  When spoofing is
  825. in effect, each Telebit modem uses the 'g' protocol to communicate
  826. with the attached computer, but the data between the modems is sent
  827. using a Telebit proprietary error correcting protocol.  This allows
  828. for very high throughput over the Telebit connection, which, because
  829. it is half-duplex, would not normally be able to handle the 'g'
  830. protocol very well at all.  When a Telebit is spoofing the 'g'
  831. protocol, it forces the packet size to be 64 bytes and the window size
  832. to be 3.
  833.  
  834. This discussion of the 'g' protocol explains how it works, but does
  835. not discuss useful error handling techniques.  Some discussion of this
  836. can be found in Jamie E. Hanrahan's paper, cited above.
  837.  
  838. All 'g' protocol communication is done with packets.  Each packet
  839. begins with a six byte header.  Control packets consist only of the
  840. header.  Data packets contain additional data.
  841.  
  842. The header is as follows:
  843.  
  844.     \020
  845.         Every packet begins with a ^P.
  846.     k (1 <= k <= 9)
  847.         The k value is always 9 for a control packet.  For a data
  848.         packet, the k value indicates how much data follows the six
  849.         byte header.  The amount of data is 2 ** (k + 4), where **
  850.         indicates exponentiation.  Thus a k value of 1 means 32 data
  851.         bytes and a k value of 8 means 4096 data bytes.  The k value
  852.         for a data packet must be between 1 and 8 inclusive.
  853.     checksum low byte
  854.     checksum high byte
  855.         The checksum value is described below.
  856.     control byte
  857.         The control byte indicates the type of packet, and is
  858.         described below.
  859.     xor byte
  860.         This byte is the xor of k, the checksum low byte, the checksum
  861.         high byte and the control byte (i.e., the second, third,
  862.         fourth and fifth header bytes).  It is used to ensure that the
  863.         header data is valid.
  864.  
  865. The control byte in the header is composed of three bit fields,
  866. referred to here as TT (two bits), XXX (three bits) and YYY (three
  867. bits).  The control is TTXXXYYY, or (TT << 6) + (XXX << 3) + YYY.
  868.  
  869. The TT field takes on the following values:
  870.     0
  871.         This is a control packet.  In this case the k byte in the
  872.         header must be 9.  The XXX field indicates the type of control
  873.         packet; these types are described below.
  874.     1
  875.         This is an alternate data channel packet.  This is not used by
  876.         UUCP.
  877.     2
  878.         This is a data packet, and the entire contents of the attached
  879.         data field (whose length is given by the k byte in the header)
  880.         are valid.  The XXX and YYY fields are described below.
  881.     3
  882.         This is a short data packet.  Let the length of the data field
  883.         (as given by the k byte in the header) be L.  Let the first
  884.         byte in the data field be B1.  If B1 is less than 128 (if the
  885.         most significant bit of B1 is 0), then there are L - B1 valid
  886.         bytes of data in the data field, beginning with the second
  887.         byte.  If B1 >= 128, let B2 be the second byte in the data
  888.         field.  Then there are L - ((B1 & 0x7f) + (B2 << 7)) valid
  889.         bytes of data in the data field, beginning with the third
  890.         byte.  In all cases L bytes of data are sent (and all data
  891.         bytes participate in the checksum calculation) but some of the
  892.         trailing bytes may be dropped by the receiver.   The XXX and
  893.         YYY fields are described below.
  894.  
  895. In a data packet (short or not) the XXX field gives the sequence
  896. number of the packet.  Thus sequence numbers can range from 0 to 7,
  897. inclusive.  The YYY field gives the sequence number of the last
  898. correctly received packet.
  899.  
  900. Each communication direction uses a window which indicates how many
  901. unacknowledged packets may be transmitted before waiting for an
  902. acknowledgement.  The window may range from 1 to 7, and may be
  903. different in each direction. For example, if the window is 3 and the
  904. last packet acknowledged was packet number 6, packet numbers 7, 0 and
  905. 1 may be sent but the sender must wait for an acknowledgement before
  906. sending packet number 2.  This acknowledgement could come as the YYY
  907. field of a data packet or as the YYY field of a RJ or RR control
  908. packet (described below).
  909.  
  910. Each packet must be transmitted in order (the sender may not skip
  911. sequence numbers).  Each packet must be acknowledged, and each packet
  912. must be acknowledged in order.
  913.  
  914. In a control packet, the XXX field takes on the following values:
  915.     1 CLOSE
  916.         The connection should be closed immediately.  This is
  917.         typically sent when one side has seen too many errors and
  918.         wants to give up.  It is also sent when shutting down the
  919.         protocol.  If an unexpected CLOSE packet is received, a CLOSE
  920.         packet should be sent in reply and the 'g' protocol should
  921.         halt, causing UUCP to enter the final handshake.
  922.     2 RJ or NAK
  923.         The last packet was not received correctly.  The YYY field
  924.         contains the sequence number of the last correctly received
  925.         packet.
  926.     3 SRJ
  927.         Selective reject.  The YYY field contains the sequence number
  928.         of a packet that was not received correctly, and should be
  929.         retransmitted.  This is not used by UUCP, and most
  930.         implementations will not recognize it.
  931.     4 RR or ACK
  932.         Packet acknowledgement.  The YYY field contains the sequence
  933.         number of the last correctly received packet.
  934.     5 INITC
  935.         Third initialization packet.  The YYY field contains the
  936.         maximum window size to use.
  937.     6 INITB
  938.         Second initialization packet.  The YYY field contains the
  939.         packet size to use.  It requests a size of 2 ** (YYY + 5).
  940.         Note that this is not the same coding used for the k byte in
  941.         the packet header (it is 1 less).  Most UUCP implementations
  942.         that request a packet size larger than 64 bytes can handle any
  943.         packet size up to that specified.
  944.     7 INITA
  945.         First initialization packet.  The YYY field contains the
  946.         maximum window size to use.
  947.  
  948. The checksum of a control packet is simply 0xaaaa - the control byte.
  949.  
  950. The checksum of a data packet is 0xaaaa - (CHECK ^ the control byte),
  951. where ^ denotes exclusive or, and CHECK is the result of the following
  952. routine as run on the contents of the data field (every byte in the
  953. data field participates in the checksum, even for a short data
  954. packet).  Below is the routine used by Taylor UUCP; it is a slightly
  955. modified version of a routine which John Gilmore patched from G.L.
  956. Chesson's original paper.  The z argument points to the data and the c
  957. argument indicates how much data there is.
  958.  
  959. int
  960. igchecksum (z, c)
  961.      register const char *z;
  962.      register int c;
  963. {
  964.   register unsigned int ichk1, ichk2;
  965.  
  966.   ichk1 = 0xffff;
  967.   ichk2 = 0;
  968.  
  969.   do
  970.     {
  971.       register unsigned int b;
  972.  
  973.       /* Rotate ichk1 left.  */
  974.       if ((ichk1 & 0x8000) == 0)
  975.         ichk1 <<= 1;
  976.       else
  977.         {
  978.           ichk1 <<= 1;
  979.           ++ichk1;
  980.         }
  981.  
  982.       /* Add the next character to ichk1.  */
  983.       b = *z++ & 0xff;
  984.       ichk1 += b;
  985.  
  986.       /* Add ichk1 xor the character position in the buffer counting from
  987.          the back to ichk2.  */
  988.       ichk2 += ichk1 ^ c;
  989.  
  990.       /* If the character was zero, or adding it to ichk1 caused an
  991.          overflow, xor ichk2 to ichk1.  */
  992.       if (b == 0 || (ichk1 & 0xffff) < b)
  993.         ichk1 ^= ichk2;
  994.     }
  995.   while (--c > 0);
  996.  
  997.   return ichk1 & 0xffff;
  998. }
  999.  
  1000. When the 'g' protocol is started, the calling UUCP sends an INITA
  1001. control packet with the window size it wishes the called UUCP to use.
  1002. The called UUCP responds with an INITA packet with the window size it
  1003. wishes the calling UUCP to use.  Pairs of INITB and INITC packets are
  1004. then similarly exchanged.  When these exchanges are completed, the
  1005. protocol is considered to have been started.
  1006.  
  1007. Note that the window and packet sizes are not a negotiation.  Each
  1008. system announces the window and packet size which the other system
  1009. should use.  It is possible that different window and packet sizes
  1010. will be used in each direction.  The protocol works this way on the
  1011. theory that each system knows how much data it can accept without
  1012. getting overrun.  Therefore, each system tells the other how much data
  1013. to send before waiting for an acknowledgement.
  1014.  
  1015. When a UUCP package transmits a command, it sends one or more data
  1016. packets.  All the data packets will normally be complete, although
  1017. some UUCP packages may send the last one as a short packet.  The
  1018. command string is sent with a trailing null byte, to let the receiving
  1019. package know when the command is finished.  Some UUCP packages require
  1020. the last byte of the last packet sent to be null, even if the command
  1021. ends earlier in the packet.  Some packages may require all the
  1022. trailing bytes in the last packet to be null, but I have not confirmed
  1023. this.
  1024.  
  1025. When a UUCP package sends a file, it will send a sequence of data
  1026. packets.  The end of the file is signalled by a short data packet
  1027. containing zero valid bytes (it will normally be preceeded by a short
  1028. data packet containing the last few bytes in the file).
  1029.  
  1030. Note that the sequence numbers cover the entire communication session,
  1031. including both command and file data.
  1032.  
  1033. When the protocol is shut down, each UUCP package sends a CLOSE
  1034. control packet.
  1035.  
  1036. ------------------------------
  1037.  
  1038. From: UUCP-f
  1039. Subject: What is the 'f' protocol?
  1040.  
  1041. The 'f' protocol is a seven bit protocol which checksums an entire
  1042. file at a time.  It only uses the characters between \040 and \176
  1043. (ASCII space and ~) inclusive as well as the carriage return
  1044. character.  It can be very efficient for transferring text only data,
  1045. but it is very inefficient at transferring eight bit data (such as
  1046. compressed news).  It is not flow controlled, and the checksum is
  1047. fairly insecure over large files, so using it over a serial connection
  1048. requires handshaking (XON/XOFF can be used) and error correcting
  1049. modems.  Some people think it should not be used even under those
  1050. circumstances.
  1051.  
  1052. I believe the 'f' protocol originated in BSD versions of UUCP.  It was
  1053. originally intended for transmission over X.25 PAD links.
  1054.  
  1055. The 'f' protocol has no startup or finish protocol.  However, both
  1056. sides typically sleep for a couple of seconds before starting up,
  1057. because they switch the terminal into XON/XOFF mode and want to allow
  1058. the changes to settle before beginning transmission.
  1059.  
  1060. When a UUCP package transmits a command, it simply sends a string
  1061. terminated by a carriage return.
  1062.  
  1063. When a UUCP package transmits a file, each byte b of the file is
  1064. translated according to the following table:
  1065.  
  1066.        0 <= b <=  037: 0172, b + 0100 (0100 to 0137)
  1067.      040 <= b <= 0171:       b        ( 040 to 0171)
  1068.     0172 <= b <= 0177: 0173, b - 0100 ( 072 to  077)
  1069.     0200 <= b <= 0237: 0174, b - 0100 (0100 to 0137)
  1070.     0240 <= b <= 0371: 0175, b - 0200 ( 040 to 0171)
  1071.     0372 <= b <= 0377: 0176, b - 0300 ( 072 to  077)
  1072.  
  1073. That is, a byte between \040 and \171 inclusive is transmitted as is,
  1074. and all other bytes are prefixed and modified as shown.
  1075.  
  1076. When all the file data is sent, a seven byte sequence is sent: two
  1077. bytes of \176 followed by four ASCII bytes of the checksum as printed
  1078. in base 16 followed by a carriage return.  For example, if the
  1079. checksum was 0x1234, this would be sent: "\176\1761234\r".
  1080.  
  1081. The checksum is initialized to 0xffff.  For each byte that is sent it
  1082. is modified as follows (where b is the byte before it has been
  1083. transformed as described above):
  1084.  
  1085.       /* Rotate the checksum left.  */
  1086.       if ((ichk & 0x8000) == 0)
  1087.         ichk <<= 1;
  1088.       else
  1089.         {
  1090.           ichk <<= 1;
  1091.           ++ichk;
  1092.         }
  1093.  
  1094.       /* Add the next byte into the checksum.  */
  1095.       ichk += b;
  1096.  
  1097. When the receiving UUCP sees the checksum, it compares it against its
  1098. own calculated checksum and replies with a single character followed
  1099. by a carriage return.
  1100.     G
  1101.         The file was received correctly.
  1102.     R
  1103.         The checksum did not match, and the file should be resent from
  1104.         the beginning.
  1105.     Q
  1106.         The checksum did not match, but too many retries have occurred
  1107.         and the communication session should be abandoned.
  1108.  
  1109. The sending UUCP checks the returned character and acts accordingly.
  1110.  
  1111. ------------------------------
  1112.  
  1113. From: UUCP-t
  1114. Subject: What is the 't' protocol?
  1115.  
  1116. The 't' protocol is intended for use on links which provide reliable
  1117. end-to-end connections, such as TCP.  It does no error checking or
  1118. flow control, and requires an eight bit clear channel.
  1119.  
  1120. I believe the 't' protocol originated in BSD versions of UUCP.
  1121.  
  1122. When a UUCP package transmits a command, it first gets the length of
  1123. the command string, C.  It then sends ((C / 512) + 1) * 512 bytes (the
  1124. smallest multiple of 512 which can hold C bytes plus a null byte)
  1125. consisting of the command string itself followed by trailing null
  1126. bytes.
  1127.  
  1128. When a UUCP package sends a file, it sends it in blocks.  Each block
  1129. contains at most 1024 bytes of data.  Each block consists of four
  1130. bytes containing the amount of data in binary (most significant byte
  1131. first, the same format as used by the Unix function htonl) followed by
  1132. that amount of data.  The end of the file is signalled by a block
  1133. containing zero bytes of data.
  1134.  
  1135. ------------------------------
  1136.  
  1137. From: UUCP-e
  1138. Subject: What is the 'e' protocol?
  1139.  
  1140. The 'e' protocol is similar to the 't' protocol.  It does no flow
  1141. control or error checking and is intended for use over networks
  1142. providing reliable end-to-end connections, such as TCP.
  1143.  
  1144. The 'e' protocol originated in versions of HDB UUCP.
  1145.  
  1146. When a UUCP package transmits a command, it simply sends the command
  1147. as an ASCII string terminated by a null byte.
  1148.  
  1149. When a UUCP package transmits a file, it sends the complete size of
  1150. the file as an ASCII decimal number.  The ASCII string is padded out
  1151. to 20 bytes with null bytes (i.e. if the file is 1000 bytes long, it
  1152. sends "1000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0").  It then sends the
  1153. entire file.
  1154.  
  1155. ------------------------------
  1156.  
  1157. From: UUCP-G
  1158. Subject: What is the 'G' protocol?
  1159.  
  1160. The 'G' protocol is used by SVR4 UUCP.  It is identical to the 'g'
  1161. protocol, except that it is possible to modify the window and packet
  1162. sizes.  The SVR4 implementation of the 'g' protocol reportedly is
  1163. fixed at a packet size of 64 and a window size of 7.  Supposedly SVR4
  1164. chose to implement a new protocol using a new letter to avoid any
  1165. potential incompatibilities when using different packet or window
  1166. sizes.
  1167.  
  1168. Most implementations of the 'g' protocol that accept packets larger
  1169. than 64 bytes will also accept packets smaller than whatever they
  1170. requested in the INITB packet.  The SVR4 'G' implementation is an
  1171. exception; it will only accept packets of precisely the size it
  1172. requests in the INITB packet.
  1173.  
  1174. ------------------------------
  1175.  
  1176. From: UUCP-i
  1177. Subject: What is the 'i' protocol?
  1178.  
  1179. The 'i' protocol was written by Ian Lance Taylor (who also wrote this
  1180. FAQ).  It is used by Taylor UUCP version 1.04.
  1181.  
  1182. It is a sliding window packet protocol, like the 'g' protocol, but it
  1183. supports bidirectional transfers (i.e., file transfers in both
  1184. directions simultaneously).  It requires an eight bit clear
  1185. connection.  Several ideas for the protocol were taken from the paper
  1186. ``A High-Throughput Message Transport System'' by P. Lauder.  I don't
  1187. know where the paper was published, but the author's e-mail address is
  1188. piers@cs.su.oz.au.  The 'i' protocol does not adopt his main idea,
  1189. which is to dispense with windows entirely.  This is because some
  1190. links still do require flow control and, more importantly, because
  1191. using windows sets a limit to the amount of data which the protocol
  1192. must be able to resend upon request.  To reduce the costs of window
  1193. acknowledgements, the protocol uses a large window and only requires
  1194. an ack at the halfway point.
  1195.  
  1196. Each packet starts with a six byte header, optionally followed by data
  1197. bytes with a four byte checksum.  There are currently five defined
  1198. packet types (DATA, SYNC, ACK, NAK, SPOS, CLOSE) which are described
  1199. below.  Although any packet type may include data, any data provided
  1200. with an ACK, NAK or CLOSE packet is ignored.
  1201.  
  1202. Every DATA, SPOS and CLOSE packet has a sequence number.  The sequence
  1203. numbers are independent for each side.  The first packet sent by each
  1204. side is always number 1.  Each packet is numbered one greater than the
  1205. previous packet, modulo 32.
  1206.  
  1207. Every packet has a local channel number and a remote channel number.
  1208. For all packets at least one channel number is zero.  When a UUCP
  1209. command is sent to the remote system, it is assigned a non-zero local
  1210. channel number.  All packets associated with that UUCP command sent by
  1211. the local system are given the selected local channel number.  All
  1212. associated packets sent by the remote system are given the selected
  1213. number as the remote channel number.  This permits each UUCP command
  1214. to be uniquely identified by the channel number on the originating
  1215. system, and therefore each UUCP package can associate all file data
  1216. and UUCP command responses with the appropriate command.  This is a
  1217. requirement for bidirectional UUCP transfers.
  1218.  
  1219. The protocol maintains a single global file position, which starts at
  1220. 0.  For each incoming packet, any associated data is considered to
  1221. occur at the current file position, and the file position is
  1222. incremented by the amount of data contained.  The exception is a
  1223. packet of type SPOS, which is used to change the file position.
  1224. The reason for keeping track of the file position is described below.
  1225.  
  1226. The header is as follows:
  1227.  
  1228.     \007
  1229.     Every packet begins with ^G.
  1230.     (PACKET << 3) + LOCCHAN
  1231.     The five bit packet number combined with the three bit local
  1232.     channel number.  DATA, SPOS and CLOSE packets use the packet
  1233.     sequence number for the PACKET field.  NAK packet types use
  1234.     the PACKET field for the sequence number to be resent.  ACK
  1235.     and SYNC do not use the PACKET field, and generally leave it
  1236.     set to 0.  Packets which are not associated with a UUCP
  1237.     command from the local system use a local channel number of 0.
  1238.     (ACK << 3) + REMCHAN
  1239.     The five bit packet acknowledgement combined with the three
  1240.     bit remote channel number.  The packet acknowledgement is the
  1241.     number of the last packet successfully received; it is used by
  1242.     all packet types.  Packets which are not sent in response to a
  1243.     UUCP command from the remote system use a remote channel
  1244.     number of 0.
  1245.     (TYPE << 5) + (CALLER << 4) + LEN1
  1246.     The three bit packet type combined with the one bit packet
  1247.     direction combined with the upper four bits of the data
  1248.     length.  The packet direction bit is always 1 for packets sent
  1249.     by the calling UUCP, and 0 for packets sent by the called
  1250.     UUCP.  This prevents confusion caused by echoed packets.
  1251.     LEN2
  1252.     The lower eight bits of the data length.  The twelve bits of
  1253.     data length permit packets ranging in size from 0 to 4095
  1254.     bytes.
  1255.     CHECK
  1256.     The exclusive or of the second through fifth bytes of the
  1257.     header.  This provides an additional check that the header is
  1258.     valid.
  1259.  
  1260. If the data length is non-zero, the packet is immediately followed by
  1261. the specified number of data bytes.  The data bytes are followed by a
  1262. four byte CRC 32 checksum, with the most significant byte first.  The
  1263. CRC is calculated over the contents of the data field.
  1264.  
  1265. The defined packet types are as follows:
  1266.  
  1267.     0 (DATA)
  1268.     This is a plain data packet.
  1269.     1 (SYNC)
  1270.     SYNC packets are exchanged when the protocol is initialized,
  1271.     and are described further below.  SYNC packets do not carry
  1272.     sequence numbers (that is, the PACKET field is ignored).
  1273.     2 (ACK)
  1274.     This is an acknowledgement packet.  Since DATA packets also
  1275.     carry packet acknowledgements, ACK packets are only used when
  1276.     one side has no data to send.  ACK packets do not carry
  1277.     sequence numbers.
  1278.     3 (NAK)
  1279.     This is a negative acknowledgement.  This is sent when a
  1280.     packet is received incorrectly, and means that the packet
  1281.     number appearing in the PACKET field must be resent.  NAK
  1282.     packets do not carry sequence numbers (the PACKET field is
  1283.     already used).
  1284.     4 (SPOS)
  1285.     This packet changes the file position.  The packet contains
  1286.     four bytes of data holding the file position, most significant
  1287.     byte first.  The next packet received will be considered to be
  1288.     at the named file position.
  1289.     5 (CLOSE)
  1290.     When the protocol is shut down, each side sends a CLOSE
  1291.     packet.     This packet does have a sequence number, which could
  1292.     be used to ensure that all packets were correctly received
  1293.     (this is not needed by UUCP, however, which uses the higher
  1294.     level H command with an HY response).
  1295.  
  1296. When the protocol starts up, both systems send a SYNC packet.  The
  1297. SYNC packet includes at least three bytes of data.  The first two
  1298. bytes are the maximum packet size the remote system should send, most
  1299. significant byte first.  The third byte is the window size the remote
  1300. system should use.  The remote system may send packets of any size up
  1301. to the maximum.  If there is a fourth byte, it is the number of
  1302. channels the remote system may use (this must be between 1 and 7,
  1303. inclusive).  Additional data bytes may be defined in the future.
  1304.  
  1305. The window size is the number of packets that may be sent before a
  1306. packet is acknowledged.  There is no requirement that every packet be
  1307. acknowledged; any acknowledgement is considered to acknowledge all
  1308. packets through the number given.  In the current implementation, if
  1309. one side has no data to send, it sends an ACK when half the window is
  1310. received.
  1311.  
  1312. Note that the NAK packet corresponds to the unused 'g' protocol SRJ
  1313. packet type, rather than to the RJ packet type.  When a NAK is
  1314. received, only the named packet should be resent, not any subsequent
  1315. packets.
  1316.  
  1317. Note that if both sides have data to send, but a packet is lost, it is
  1318. perfectly reasonable for one side to continue sending packets, all of
  1319. which will acknowledge the last packet correctly received, while the
  1320. system whose packet was lost will be unable to send a new packet
  1321. because the send window will be full.  In this circumstance, neither
  1322. side will time out and one side of the communication will be
  1323. effectively shut down for a while.  Therefore, any system with
  1324. outstanding unacknowledged packets should arrange to time out and
  1325. resend a packet even if data is being received.
  1326.  
  1327. Commands are sent as a sequence of data packets with a non-zero local
  1328. channel number.  The last data packet for a command includes a
  1329. trailing null byte (normally a command will fit in a single data
  1330. packet).  Files are sent as a sequence of data packets ending with one
  1331. of length zero.
  1332.  
  1333. The channel numbers permit a more efficient implementation of the UUCP
  1334. file send command.  Rather than send the command and then wait for the
  1335. SY response before sending the file, the file data is sent beginning
  1336. immediately after the S command is sent.  If an SN response is
  1337. received, the file send is aborted, and a final data packet of length
  1338. zero is sent to indicate that the channel number may be reused.  If an
  1339. SY reponse with a file position indicator is received, the file send
  1340. adjusts to the file position; this is why the protocol maintains a
  1341. global file position.
  1342.  
  1343. Note that the use of channel numbers means that each UUCP system may
  1344. send commands and file data simultaneously.  Moreover, each UUCP
  1345. system may send multiple files at the same time, using the channel
  1346. number to disambiguate the data.  Sending a file before receiving an
  1347. acknowledgement for the previous file helps to eliminate the round
  1348. trip delays inherent in other UUCP protocols.
  1349.  
  1350. ------------------------------
  1351.  
  1352. From: UUCP-j
  1353. Subject: What is the 'j' protocol?
  1354.  
  1355. The 'j' protocol is a variant of the 'i' protocol.  It was also
  1356. written by Ian Lance Taylor, and first appeared in Taylor UUCP version
  1357. 1.04.
  1358.  
  1359. The 'j' protocol is a version of the 'i' protocol designed for
  1360. communication links which intercept a few characters, such as XON or
  1361. XOFF.  It is not efficient to use it on a link which intercepts many
  1362. characters, such as a seven bit link.  The 'j' protocol performs no
  1363. error correction or detection; that is presumed to be the
  1364. responsibility of the 'i' protocol.
  1365.  
  1366. When the 'j' protocol starts up, each system sends a printable ASCII
  1367. string indicating which characters it wants to avoid using.  The
  1368. string begins with the ASCII character '^' (octal 136) and ends with
  1369. the ASCII character '~' (octal 176).  After sending this string, each
  1370. system looks for the corresponding string from the remote system.  The
  1371. strings are composed of escape sequences: \ooo, where o is an octal
  1372. digit.  For example, sending the string ^\021\023~ means that the
  1373. ASCII XON and XOFF characters should be avoided.  The union of the
  1374. characters described in both strings (the string which is sent and the
  1375. string which is received) is the set of characters which must be
  1376. avoided in this conversation.  Avoiding a printable ASCII character
  1377. (octal 040 to octal 176, inclusive) is not permitted.
  1378.  
  1379. After the exchange of characters to avoid, the normal 'i' protocol
  1380. start up is done, and the rest of the conversation uses the normal 'i'
  1381. protocol.  However, each 'i' protocol packet is wrapped to become a
  1382. 'j' protocol packet.
  1383.  
  1384. Each 'j' protocol packet consists of a seven byte header, followed by
  1385. data bytes, followed by index bytes, followed by a one byte trailer.
  1386. The packet header looks like this:
  1387.  
  1388.     ^
  1389.         Every packet begins with the ASCII character '^', octal 136.
  1390.     HIGH
  1391.     LOW
  1392.         These two characters give the total number of bytes in the
  1393.         packet.  Both HIGH and LOW are printable ASCII characters.
  1394.         The length of the packet is (HIGH - 040) * 0100 + (LOW - 040),
  1395.         where 040 <= HIGH < 0177 and 040 <= LOW < 0140.  This permits
  1396.         a length of 6079 bytes, but there is a further restriction on
  1397.         packet size described below.
  1398.     =
  1399.         The ASCII character '=', octal 075.
  1400.     DATA-HIGH
  1401.     DATA-LOW
  1402.     These two characters give the total number of data bytes in
  1403.         the packet.  The encoding is as described for HIGH and LOW.
  1404.         The number of data bytes is the size of the 'i' protocol
  1405.         packet wrapped inside this 'j' protocol packet.
  1406.     @
  1407.     The ASCII character '@', octal 100.
  1408.  
  1409. The header is followed by the number of data bytes given in DATA-HIGH
  1410. and DATA-LOW.  These data bytes are the 'i' protocol packet which is
  1411. being wrapped in the 'j' protocol packet.  However, each character in
  1412. the 'i' protocol packet which the 'j' protocol must avoid is
  1413. transformed into a printable ASCII character (recall that avoiding a
  1414. printable ASCII character is not permitted).  Two index bytes are used
  1415. for each character which must be transformed.
  1416.  
  1417. The index bytes immediately follow the data bytes.  The index bytes
  1418. are created in pairs.  Each pair of index bytes encodes the location
  1419. of a character in the 'i' protocol packet which was transformed to
  1420. become a printable ASCII character.  Each pair of index bytes also
  1421. encodes the precise transformation which was performed.
  1422.  
  1423. When the sender finds a character which must be avoided, it will
  1424. transform it using one or two operations.  If the character is 0200 or
  1425. greater, it will subtract 0200.  If the resulting character is less
  1426. than 020, or is equal to 0177, it will xor by 020.  The result is
  1427. a printable ASCII character.
  1428.  
  1429. The zero based byte index of the character within the 'i' protocol
  1430. packet is determined.  This index is turned into a two byte printable
  1431. ASCII index, INDEX-HIGH and INDEX-LOW, such that the index is
  1432. (INDEX-HIGH - 040) * 040 + (INDEX-LOW - 040).  INDEX-LOW is restricted
  1433. such that 040 <= INDEX-LOW < 0100.  INDEX-HIGH is not permitted to be
  1434. 0176, so 040 <= INDEX-HIGH < 0176.  INDEX-LOW is then modified to
  1435. encode the transformation:
  1436.  
  1437.     If the character transformation only had to subtract 0200, then
  1438.     INDEX-LOW is used as is.
  1439.  
  1440.     If the character transformation only had to xor by 020, then 040
  1441.     is added to INDEX-LOW.
  1442.  
  1443.     If both operations had to be performed, then 0100 is added to
  1444.     INDEX-LOW.  However, if the value of INDEX-LOW were initially 077,
  1445.     then adding 0100 would result in 0177, which is not a printable
  1446.     ASCII character.  For that special case, INDEX-HIGH is set to
  1447.     0176, and INDEX-LOW is set to the original value of INDEX-HIGH.
  1448.  
  1449. The receiver decodes the index bytes as follows (this is the reverse
  1450. of the operations performed by the sender, presented here for
  1451. additional clarity):
  1452.  
  1453.     The first byte in the index is INDEX-HIGH, and the second is
  1454.     INDEX-LOW.
  1455.  
  1456.     If 040 <= INDEX-HIGH < 0176, the index refers to the data byte at
  1457.     position (INDEX-HIGH - 040) * 040 + INDEX-LOW % 040.
  1458.  
  1459.         If 040 <= INDEX-LOW < 0100, then 0200 must be added to indexed
  1460.         byte.
  1461.  
  1462.         If 0100 <= INDEX-LOW < 0140, then 020 must be xor'ed to the
  1463.         indexed byte.
  1464.  
  1465.         If 0140 <= INDEX-LOW < 0177, then 0200 must be added to the
  1466.         indexed byte, and 020 must be xor'ed to the indexed byte.
  1467.  
  1468.     If INDEX-HIGH == 0176, the index refers to the data byte at
  1469.     position (INDEX-LOW - 040) * 040 + 037.  0200 must be added to the
  1470.     indexed byte, and 020 must be xor'ed to the indexed byte.
  1471.  
  1472. This means the largest 'i' protocol packet which may be wrapped inside
  1473. a 'j' protocol packet is (0175 - 040) * 040 + (077 - 040) == 3007
  1474. bytes.
  1475.  
  1476. The final character in a 'j' protocol packet, following the index
  1477. bytes, is the ASCII character '~' (octal 176).
  1478.  
  1479. The motivation behind using an indexing scheme, rather than escape
  1480. characters, is to avoid data movement.  The sender may simply add a
  1481. header and a trailer to the 'i' protocol packet.  Once the receiver
  1482. has loaded the 'j' protocol packet, it may scan the index bytes,
  1483. transforming the data bytes, and then pass the data bytes directly on
  1484. to the 'i' protocol routine.
  1485.  
  1486. ------------------------------
  1487.  
  1488. From: UUCP-x
  1489. Subject: What is the 'x' protocol?
  1490.  
  1491. The 'x' protocol is used in Europe (and probably elsewhere) with
  1492. machines that contain an builtin X.25 card and can send eight bit data
  1493. transparently across X.25 circuits, without interference from the X.28
  1494. or X.29 layers.  The protocol sends packets of 512 bytes, and relies
  1495. on a write of zero bytes being read as zero bytes without stopping
  1496. communication.  It first appeared in the original System V UUCP
  1497. implementation.
  1498.  
  1499. ------------------------------
  1500.  
  1501. From: UUCP-y
  1502. Subject: What is the 'y' protocol?
  1503.  
  1504. The 'y' protocol was developed by Jorge Cwik for use in FX UUCICO, a
  1505. PC uucico program.  It is designed for communication lines which
  1506. handle error correction and flow control.  It is a streaming protocol,
  1507. like the 'f' protocol.  It requires an eight bit clean connection.  It
  1508. performs error detection, but not error correction; when an error is
  1509. detected, the line is dropped.  I do not know the implementation
  1510. details.
  1511.  
  1512. ------------------------------
  1513.  
  1514. From: UUCP-d
  1515. Subject: What is the 'd' protocol?
  1516.  
  1517. This is apparently used for DataKit muxhost (not RS-232) connections.
  1518. No file size is sent.  When a file has been completely transferred, a
  1519. write of zero bytes is done; this must be read as zero bytes on the
  1520. other end.
  1521.  
  1522. ------------------------------
  1523.  
  1524. From: UUCP-h
  1525. Subject: What is the 'h' protocol?
  1526.  
  1527. This is apparently used in some places with HST modems.  It does no
  1528. error checking, and is not that different from the 't' protocol.  I
  1529. don't know the details.
  1530.  
  1531. ------------------------------
  1532.  
  1533. From: UUCP-v
  1534. Subject: What is the 'v' protocol?
  1535.  
  1536. The 'v' protocol is used by UUPC/extended, a PC UUCP program.  It is
  1537. simply a version of the 'g' protocol which supports packets of any
  1538. size, and also supports sending packets of different sizes during the
  1539. same conversation.  There are many 'g' protocol implementations which
  1540. support both, but there are also many which do not.  Using 'v' ensures
  1541. that everything is supported.
  1542.  
  1543. ------------------------------
  1544.  
  1545. From: Thanks
  1546. Subject: Thanks
  1547.  
  1548. Besides the papers and information acknowledged at the top of this
  1549. article, the following people have contributed help, advice,
  1550. suggestions and information:
  1551.     Earle Ake 513-429-6500 <ake@Dayton.SAIC.COM>
  1552.     cambler@nike.calpoly.edu (Christopher J. Ambler)
  1553.     jhc@iscp.bellcore.com (Jonathan Clark)
  1554.     jorge@laser.satlink.net (Jorge Cwik)
  1555.     celit!billd@UCSD.EDU (Bill Davidson)
  1556.     "Drew Derbyshire" <ahd@kew.com>
  1557.     erik@pdnfido.fidonet.org
  1558.     Matthew Farwell <dylan@ibmpcug.co.uk>
  1559.     dgilbert@gamiga.guelphnet.dweomer.org (David Gilbert)
  1560.     kherron@ms.uky.edu (Kenneth Herron)
  1561.     Mike Ipatow <mip@fido.itc.e-burg.su>
  1562.     Romain Kang <romain@pyramid.com>
  1563.     "Jonathan I. Kamens" <jik@GZA.COM>
  1564.     "David J. MacKenzie" <djm@eng.umd.edu>
  1565.     jum@helios.de (Jens-Uwe Mager)
  1566.     peter@xpoint.ruessel.sub.org (Peter Mandrella)
  1567.     david nugent <david@csource.oz.au>
  1568.     Stephen.Page@prg.oxford.ac.uk
  1569.     joey@tessi.UUCP (Joey Pruett)
  1570.     James Revell <revell@uunet.uu.net>
  1571.     Larry Rosenman <ler@lerami.lerctr.org>
  1572.     Rich Salz <rsalz@bbn.com>
  1573.     evesg@etlrips.etl.go.jp (Gjoen Stein)
  1574.     kls@ditka.Chicago.COM (Karl Swartz)
  1575.     Dima Volodin <dvv@hq.demos.su>
  1576.     jon@console.ais.org (Jon Zeeff)
  1577.     Eric Ziegast <ziegast@uunet.uu.net>
  1578.  
  1579. ------------------------------
  1580.  
  1581. End of UUCP Internals Frequently Asked Questions
  1582. ******************************
  1583. -- 
  1584. Ian Taylor | ian@airs.com | First to identify quote wins free e-mail message:
  1585. ``Let me state here a personal conviction that appears, right now, to be
  1586.   profoundly unfashionable; which is that a planned economy can be more
  1587.   productive - and more morally desirable - than one left to market forces.''
  1588.